/**
 * Project: push-center-biz-dal
 * 
 * File Created at 2014年10月9日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package com.greenline.push.dal.pushcenter.impl;

import java.util.List;

import com.greenline.push.dal.base.BaseDAO;
import com.greenline.push.dal.pushcenter.GroupAppDao;
import com.greenline.push.dal.pushcenter.dataobject.GroupAppDO;
import com.greenline.push.dal.query.GroupAppQuery;

/**
 * @Type GroupAppDAOImpl
 * @Desc
 * @author shuai.zuo
 * @date 2014年10月9日
 * @Version V1.0
 */
public class GroupAppDAOImpl extends BaseDAO implements GroupAppDao {

    /*
     * (non-Javadoc)
     * 
     * @see com.greenline.push.dal.pushcenter.groupAppDAO#insert(com.greenline.
     * push.dal.pushcenter.dataobject.groupAppDO)
     */
    @Override
    public Long insert(GroupAppDO groupAppDO) {
        return (Long) super.getSqlMapClientTemplate().insert("groupApp.insert", groupAppDO);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.greenline.push.dal.pushcenter.groupAppDAO#getgroupAppById(java
     * .lang.Long)
     */
    @Override
    public GroupAppDO getById(Long id) {
        return (GroupAppDO) super.getSqlMapClientTemplate().queryForObject("groupApp.find_by_id", id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.greenline.push.dal.pushcenter.groupAppDAO#update(com.greenline.
     * push.dal.pushcenter.dataobject.groupAppDO)
     */
    @Override
    public int update(GroupAppDO groupAppDO) {
        return super.getSqlMapClientTemplate().update("groupApp.update", groupAppDO);
    }

    /*
     * (non-Javadoc)
     * 
     * @see
     * com.greenline.push.dal.pushcenter.groupAppDAO#listByQuery(com.greenline
     * .push.dal.query.groupAppQuery)
     */
    @Override
    public GroupAppQuery listByQuery(GroupAppQuery query) {
        return (GroupAppQuery) super.listByQuery("groupApp.list_by_query", query);
    }

    @Override
    public int deleteById(Long id) {
        return super.getSqlMapClientTemplate().update("groupApp.delete", id);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<GroupAppDO> listByAppId(Long appId) {
        return super.getSqlMapClientTemplate().queryForList("groupApp.list_by_appId", appId);
    }

}
